﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using BLL;
using Model;
using Common;
using AdminWeb.Filter;
using AdminWeb.Models;

// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Web.Areas.Admin.Controllers
{
    [Area("Admin")]
    public class StatsCodeController : Controller
    {
        [CheckAdminLogin]
        public IActionResult Index()
        {
            SystemParameterBLL bll = new SystemParameterBLL();
            ViewBag.Value = bll.GetModel("StatsCode").Value;
            return View();
        }
        [HttpPost]
        public string Save()
        {
            SystemParameterBLL bll = new SystemParameterBLL();
            SystemParameter model = new SystemParameter();
            model.Type = "StatsCode";
            model.Value = Request.Form["statscode"];
            return JSONHelper.SerializeObject(bll.Update(model));
        }
    }
}
